import React from 'react';
import Button from './button'
class List extends React.Component {
    shouldComponentUpdate(newProps,newState){
        console.log(newProps,newState,this.props)
        // newprops 是新的props,刚获得的props;this.props是上一次获取的props
        if(newProps.data.length == this.props.data.length){
          return false
        }else{
          return true
        }
        // return true
    }
    render() {
      let {data=[],onDel} = this.props;
      console.log(666)
        return <ul className=''>
        {
          data.map((item,i)=>{
            return <li key={i}>{item}  <Button onClick123={onDel.bind(null,i)}>X</Button></li>
          })
        }
          
        </ul>;
    }
}
export default List